# 查找 DNA 的CG字符串
def CountersCG(STR):
    CG = 0
    for i in STR:
        if i == 'C' or i == 'G':
            CG += 1
    return CG/len(STR)

def CheckGC(STR, A):
    k = -1 
    Outstr = ''
    if len(STR) != A:
        for i in range(0, len(STR) - A):
            if k < CountersCG(STR[i:A+i]):
                k = CountersCG(STR[i:A+i])
                Outstr = STR[i:A+i]
    else:
        Outstr = STR
    print(Outstr)

CheckGC(input(), int(input()))